//
//  ShoppingCartCell.m
//  YaDiuDiu
//
//  Created by 欧洪飞 on 2017/10/19.
//  Copyright © 2017年 jy. All rights reserved.
//

#import "ShoppingCartCell.h"

@implementation ShoppingCartCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
//-
- (IBAction)minus:(id)sender {
    self.number -=1;
    [self showNumber:self.number];
    self.operationBlock(self.number,NO);
}
//+
- (IBAction)plus:(id)sender {
    self.number += 1;
    [self showNumber:self.number];
    self.operationBlock(self.number,YES);
}

-(void)showNumber:(NSUInteger)count
{
    self.labNum.text = [NSString stringWithFormat:@"%lu",(unsigned long)self.number];
    if (self.number > 0)
    {
        [self.btnMinus setHidden:NO];
        [self.labNum setHidden:NO];
    }
    else
    {
        [self.btnMinus setHidden:YES];
        [self.labNum setHidden:YES];
    }
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    [self showNumber:self.number];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
